package com.pickgliss.ui.controls
{
	import com.pickgliss.ui.ComponentFactory;
	import com.pickgliss.ui.text.FilterFrameText;

	public class SelectedIconTextButton extends SelectedIconButton
	{
		public static const P_textStyle		:String = "textStyle";
		
		protected var _textStyle:String;
		public function set textStyle(value:String):void
		{
			if (_textStyle == value)
				return;
			_textStyle = value;
			onPropertiesChanged(P_textStyle);
		}
		public function get textStyle():String
		{
			return _textStyle;
		}
		
		override protected function onProppertiesUpdate():void
		{
			super.onProppertiesUpdate();
			if (_changedPropeties[P_textStyle])
			{
				_text = ComponentFactory.Instance.creatComponentByStylename(_textStyle);
			}
		}
		
		override protected function addChildren():void
		{
			super.addChildren();
			if(_text)addChild(_text);
		}
		
		protected var _text	:FilterFrameText;
		public function SelectedIconTextButton()
		{
			super();
		}
		
		public function set text(value:String):void
		{
			if(_text)_text.text = value;
		}
		
		override public function set selected(value:Boolean):void
		{
			super.selected = value;
			if(!_text)return;
			if(value)
			{
				_text.setFrame(2);
			}
			else
			{
				_text.setFrame(1);
			}
		}
	}
}